package com.tianji.learning.controller;

import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.query.QuestionAdminPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminDetailVO;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@RequestMapping("/admin/questions")
public class InteractionQuestionAdminController {

    private final IInteractionQuestionService questionService;

    @GetMapping("/page")
    @ApiOperation("管理端分页查询问题")
    public PageDTO<QuestionAdminVO> pageAdminQuestions(@RequestBody QuestionAdminPageQuery query) {
        return questionService.pageAdminQuestions(query);
    }

    @PutMapping("/{id}/hidden/{hidden}")
    @ApiOperation("隐藏评论操作")
    public void hiddenQuestion(@PathVariable Long id,@PathVariable Boolean hidden) {
        questionService.hiddenQuestion(id,hidden);
    }

    @GetMapping("/{id}")
    @ApiOperation("根据问题id查看问题详情")
    public QuestionAdminDetailVO getQuestion(@PathVariable Long id) {
        return questionService.getQuestionDetail(id);
    }


}
